package com.gamejelly.proxy.pojo;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Created by haoyifen on 2017/6/16 22:08.
 */
@Data
@NoArgsConstructor
public class RpcResponse {
    private String requestId;
    private int code;
    private String msg;
    private Object data;

    public static RpcResponse ok(String requestId, Object data) {
        RpcResponse rpcResponse = new RpcResponse();
        rpcResponse.setRequestId(requestId);
        rpcResponse.setCode(0);
        rpcResponse.setData(data);
        return rpcResponse;
    }

    public static RpcResponse fail(String requestId, int code, String msg) {
        RpcResponse rpcResponse = new RpcResponse();
        rpcResponse.setRequestId(requestId);
        rpcResponse.setCode(code);
        rpcResponse.setMsg(msg);
        return rpcResponse;
    }
}
